package chatTCP;

import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;

public class chatclientTCP {
	public static void main(String[] args) throws Exception{
		Socket soc=new Socket("127.0.0.1",9999);
		//1 client send request server
		PrintWriter out=new PrintWriter(soc.getOutputStream(),true);
		String request="chieu nay hoc nghe mi..";
		out.println(request);
		//5 client nhan response tu server
		Scanner input=new Scanner(soc.getInputStream());
		String response=input.nextLine();
		//6 manipulate response
		System.out.println(response);
		soc.close();input.close();
	}
}
